package com.Lyoto.NetNotify.Handler.impl;

import com.Lyoto.NetNotify.Constraint.NetConfig;
import com.Lyoto.NetNotify.Handler.PushRegistrar;
import com.Lyoto.util.weixin.bean.ValueAndColor;
import com.Lyoto.util.weixin.config.ApiConfig;
import com.Lyoto.util.weixin.utils.WxClient;
import lombok.extern.slf4j.Slf4j;

import java.util.LinkedHashMap;

/***
 @author Lyoto
 @description
 @create 12/3/2023-下午6:04
 ***/
@Slf4j
public class WechatPush implements PushRegistrar {
    public WechatPush() {
        log.info("推送启动加载项|正在配置微信推送……");
    }

    @Override
    public void pushOn() {
        WxClient wxClient = new WxClient();
        LinkedHashMap<String, ValueAndColor> kvc = new LinkedHashMap<>();
        kvc.put("ip",new ValueAndColor(NetConfig.getIp(),"#173177"));
        wxClient.sendTplMessage(ApiConfig.URL.templateMessageSendApi,ApiConfig.adminId, ApiConfig.fetchIpTemplateId
                ,kvc);
    }
}
